<?php

//1. find the session
session_start();
//2. Unset all varialbes 
$_SESSION = array();

//3. Unset the cookie
// if(isset($_COOKIE[session_name()])) {
if(isset($_COOKIE["id"])) {
    // setcookie(session_name(),time()-3600,'/',0,0);
    setcookie("id", "", time()-3600);
}
if(isset($_COOKIE["email"])) {
    setcookie("email", "", time()-3600);
}
//4. destroy session
session_destroy();

//redirect
header('location: index.php');
?>